//  外呼列表
//  ZPwaihuaListViewController.m
//  HCNewGoldFinger
//
//  Created by 刘琛 on 2017/6/16.
//  Copyright © 2017年 zjhcsoftios. All rights reserved.
//

#import "ZPwaihuaListViewController.h"
#import "ZPchaxunTableViewCell.h"
#import "ZPwaihuDetailViewController.h"
#import "NetworkAddress.h"
#import "NSBundle+AssociatedBundle.h"

@interface ZPwaihuaListViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation ZPwaihuaListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"外呼列表";
    
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - Height_NavBar) style:UITableViewStylePlain];
        _tableView.dataSource = self;
        _tableView.delegate = self;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        [_tableView registerNib:[UINib nibWithNibName:@"ZPchaxunTableViewCell" bundle:[NSBundle bundleWithBundleName:@"NewMarketLib" podName:@"NewMarketLib"]] forCellReuseIdentifier:@"ZPchaxunTableViewCellIdentify"];
        [self.view addSubview:_tableView];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)setList:(NSArray *)list {
    _list = list;
    [self.tableView reloadData];
}

#pragma tableDelegate

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 70;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _list.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ZPchaxunTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ZPchaxunTableViewCellIdentify" forIndexPath:indexPath];
    cell.model = _list[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    ZPwaihuDetailViewController *vc = [[ZPwaihuDetailViewController alloc] init];
    vc.model = _list[indexPath.row];
    [self.navigationController pushViewController:vc animated:YES];
}


@end
